<!DOCTYPE html>
<HTML>
<HEAD><meta name="viewport" content="width=device-width, initial-scale=1">
<Title>3D Scatter Groups</Title>
<link type='text/css' rel='Stylesheet' href="maxchartapi.css" />
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">

<p class="heading0">ChartDirector 7.0 (Java Edition)</p>
<p class="heading1">3D Scatter Groups</p>
<hr class="separator">
<div class="content">
<img src="images/threedscattergroups.png" width='800' height='520'>
<br><br>
This example demonstrates multiple symbol groups by calling <a href="ThreeDScatterChart.addScatterGroup.htm">ThreeDScatterChart.addScatterGroup</a> multiple times with different data and colors.
</div>
<p class="heading1a">Source Code Listing</p>
<div class="content">
<b>[JSP Version]</b> jspdemo/threedscattergroups.jsp
<div class='codeblock'><code class='pre'>&lt;%@page import="ChartDirector.*, java.util.*" %&gt;
&lt;%
// The random XYZ data for the first 3D scatter group
RanSeries r0 = new RanSeries(7);
double[] xData0 = r0.getSeries2(100, 100, -10, 10);
double[] yData0 = r0.getSeries2(100, 0, 0, 20);
double[] zData0 = r0.getSeries2(100, 100, -10, 10);

// The random XYZ data for the second 3D scatter group
RanSeries r1 = new RanSeries(4);
double[] xData1 = r1.getSeries2(100, 100, -10, 10);
double[] yData1 = r1.getSeries2(100, 0, 0, 20);
double[] zData1 = r1.getSeries2(100, 100, -10, 10);

// The random XYZ data for the third 3D scatter group
RanSeries r2 = new RanSeries(8);
double[] xData2 = r2.getSeries2(100, 100, -10, 10);
double[] yData2 = r2.getSeries2(100, 0, 0, 20);
double[] zData2 = r2.getSeries2(100, 100, -10, 10);

// Create a ThreeDScatterChart object of size 800 x 520 pixels
ThreeDScatterChart c = new ThreeDScatterChart(800, 520);

// Add a title to the chart using 20 points Times New Roman Italic font
c.addTitle("3D Scatter Groups                    ", "Times New Roman Italic", 20);

// Set the center of the plot region at (350, 240), and set width x depth x height to 360 x 360 x
// 270 pixels
c.setPlotRegion(350, 240, 360, 360, 270);

// Set the elevation and rotation angles to 15 and 30 degrees
c.setViewAngle(15, 30);

// Add a legend box at (640, 180)
c.addLegend(640, 180);

// Add 3 scatter groups to the chart with 9 pixels glass sphere symbols of red (ff0000), green
// (00ff00) and blue (0000ff) colors
c.addScatterGroup(xData0, yData0, zData0, "Alpha", Chart.GlassSphere2Shape, 9, 0xff0000);
c.addScatterGroup(xData1, yData1, zData1, "Beta", Chart.GlassSphere2Shape, 9, 0x00ff00);
c.addScatterGroup(xData2, yData2, zData2, "Gamma", Chart.GlassSphere2Shape, 9, 0x0000ff);

// Set the x, y and z axis titles
c.xAxis().setTitle("X-Axis Place Holder");
c.yAxis().setTitle("Y-Axis Place Holder");
c.zAxis().setTitle("Z-Axis Place Holder");

// Output the chart
WebChartViewer viewer = new WebChartViewer(request, "chart1");
viewer.setChart(c, Chart.SVG);

// Include tool tip for the chart
viewer.setImageMap(c.getHTMLImageMap("", "",
    "title='&lt;*cdml*&gt;&lt;*b*&gt;&lt;*u*&gt;{dataSetName}&lt;*/u*&gt;&lt;*/b*&gt;&lt;*br*&gt;X={x|p}&lt;*br*&gt;Y={y|p}&lt;*br*&gt;Z={z|p}'"));
%&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;3D Scatter Groups&lt;/title&gt;
    &lt;!-- Include ChartDirector Javascript Library to support chart interactions --&gt;
    &lt;script type="text/javascript" src="cdjcv.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body style="margin:5px 0px 0px 5px"&gt;
    &lt;div style="font:bold 18pt verdana;"&gt;
        3D Scatter Groups
    &lt;/div&gt;
    &lt;hr style="border:solid 1px #000080; background:#000080" /&gt;
    &lt;div style="font:10pt verdana; margin-bottom:1.5em"&gt;
        &lt;a href="viewsource.jsp?file=&lt;%=request.getServletPath()%&gt;"&gt;View Source Code&lt;/a&gt;
    &lt;/div&gt;
    &lt;!-- ****** Here is the chart image ****** --&gt;
    &lt;%= viewer.renderHTML(response) %&gt;
&lt;/body&gt;
&lt;/html&gt;</code></div>
</div>
<br><hr class="separator"><div class="copyright">&copy; 2022 Advanced Software Engineering Limited. All rights reserved.</div>
</body>
</HTML>
